﻿<UserControl x:Class="CrazyWorship1.LyricController"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:Controls="clr-namespace:FluidKit.Controls;assembly=FluidKit"
  xmlns:sys="clr-namespace:System;assembly=mscorlib"
    MaxHeight="1700" MaxWidth="1700">
    <Grid >
        <Grid.Resources>
            <LinearGradientBrush x:Key="ReflectionBrush"
							 StartPoint="0,0"
							 EndPoint="0,1">
                <LinearGradientBrush.GradientStops>
                    <GradientStop Offset="0"
							  Color="#7FFFFFFF" />
                    <GradientStop Offset=".5"
							  Color="Transparent" />
                </LinearGradientBrush.GradientStops>
            </LinearGradientBrush>
            <DataTemplate x:Key="TestDataTemplate"
					  DataType="{x:Type UIElement}">
                <Border x:Name="ElementVisual"
					Background="White"
					Padding="5"
					BorderThickness="5"
					BorderBrush="LightGray"
					Grid.Row="0">
                    <Label HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="{Binding Value}"/>
                    <!--<Image Source="{Binding}"
					   Stretch="Fill" />-->
                </Border>
            </DataTemplate>
            <DataTemplate x:Key="TestDataTemplate_Reflection"
					  DataType="{x:Type UIElement}">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition />
                        <RowDefinition />
                    </Grid.RowDefinitions>

                    <Border x:Name="ElementVisual"
						Background="White"
						Padding="5"
						BorderThickness="5"
						BorderBrush="LightGray"
						Grid.Row="0">
                        <Label HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Content="{Binding Value}"/>
                        
						
                    </Border>
                    <Rectangle OpacityMask="{StaticResource ReflectionBrush}"
						   Grid.Row="1">
                        <Rectangle.Fill>
                            <VisualBrush Visual="{Binding ElementName=ElementVisual}"
									 RenderOptions.CachingHint="Cache">
                                <VisualBrush.Transform>
                                    <ScaleTransform ScaleX="1"
												ScaleY="-1"
												CenterX="200"
												CenterY="150" />
                                </VisualBrush.Transform>
                            </VisualBrush>
                        </Rectangle.Fill>
                    </Rectangle>
                </Grid>
            </DataTemplate>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition Height="*" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>

        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="0.5*" />
            <ColumnDefinition Width="0.5*" />
        </Grid.ColumnDefinitions>
        <ItemsControl x:Name="_itemsControl"
					 Height="{Binding Path=Height}"
					  Grid.Row="0"
					  Grid.Column="0"
					  Grid.ColumnSpan="2"
					 
					  ItemTemplate="{StaticResource TestDataTemplate_Reflection}">
            <ItemsControl.ItemsPanel>
                <ItemsPanelTemplate>
                    <Controls:ElementFlow x:Name="ElementFlow"
										  Focusable="True"
										  TiltAngle="{Binding ElementName=TiltAngle,Path=Value}"
										  ItemGap="{Binding ElementName=ItemGap,Path=Value}"
										  FrontItemGap="{Binding ElementName=FrontItemGap,Path=Value}"
                                          SelectedIndexChanged="EFSelectedIndexChanged"
										  PopoutDistance="{Binding ElementName=PopoutDistance,Path=Value}"
										  ElementWidth="400"
										  ElementHeight="600"
										  HasReflection="False"
										  Background="Black">
                        <Controls:ElementFlow.Camera>
                            <PerspectiveCamera FieldOfView="60"
											   Position="0,1,2"
											   LookDirection="0,-1,-2"
											   UpDirection="0,1,0" />
                        </Controls:ElementFlow.Camera>
                    </Controls:ElementFlow>
                </ItemsPanelTemplate>
            </ItemsControl.ItemsPanel>
        </ItemsControl>
        <Button Height="23" Margin="12,12,0,0" Name="startButton" VerticalAlignment="Top" HorizontalAlignment="Left" Width="75" Click="button4_Click">StartSong</Button>
        <Button Margin="93,12,132,0" Name="button5" Click="button5_Click" Height="23" VerticalAlignment="Top">EndSong</Button>
        <StackPanel Margin="0,219,0,0" HorizontalAlignment="Left" Width="198" Height="197" VerticalAlignment="Top">
            <TextBlock Foreground="White">Tilt Angle</TextBlock>
            <Slider Name="TiltAngle" Value="0" Height="23"></Slider>
            <TextBlock Foreground="White">Item Gap</TextBlock>
            <Slider Name="ItemGap" Value="0.1" Height="23"></Slider>
            <TextBlock Foreground="White">Front Item Gap</TextBlock>
            <Slider Name="FrontItemGap" Value="0.1" Height="23"></Slider>
            <TextBlock Foreground="White">Popout Distance</TextBlock>
            <Slider Name="PopoutDistance" Value="0.1" Height="23"></Slider>
            <TextBlock Foreground="White">Field of View</TextBlock>
            <Slider Name="FieldOfView" Value="60" Height="23"></Slider>
        </StackPanel>
    </Grid>
</UserControl>
